import demo.main
from common.utils import get_module

import common.common_init as common_init

current_module = get_module(__file__)

common_init.init_module(current_module)


def handleQuery(query):
    return common_init.handleQuery(query, current_module)
    pass

# """
# 封装配置
# """
# from albertv0 import *
#
# from common.common_init import test
# from common.read_file import read_json
# from common.utils import get_current_path
#
# from .main import Main
#
# root_path = get_current_path(__file__)
# plugin_path = root_path + '/plugin.json'
# config = read_json(plugin_path)
#
# __iid__ = config['ID']
# __prettyname__ = config['Name']
# __version__ = config['Version']
# __trigger__ = config['ActionKeyword'] + ' '
# __author__ = config['Author']
# __dependencies__ = [config['Description']]
#
# iconPath = iconLookup(root_path + config['IcoPath'])
#
#
# def handleQuery(query):
#     if not query.isTriggered:
#         return None
#     info(test())
#     rs = Main.handle_query(query.string.strip())
#     if len(rs) == 0:
#         return Item(
#             id=__prettyname__,
#             icon=iconPath,
#             text='no result',
#             subtext="please check you input...",
#         )
#     if isinstance(rs, dict):
#         rs = [rs]
#     results = []
#     for i in range(len(rs)):
#         _rs = rs[i]
#         item = Item(
#             id=__prettyname__,
#             icon=iconPath,
#             text=_rs['text'],
#             subtext=_rs['subtext'],
#             completion=_rs['completion'],
#             actions=_rs['actions']
#         )
#         results.append(item)
#         pass
#     return results
#     pass
